package com.cj.netlibrary.retrofit

import com.cj.commonlibrary.BaseUrl
import com.cj.netlibrary.okhttp.OkHttpManager
import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory

/**
 *created by chen jun
 *on 2021/5/25 14:15
 */
object RetrofitWithCoroutineManager {
    private val retrofit: Retrofit by lazy {
        Retrofit.Builder()
            .client(OkHttpManager.okHttpClient)
            .baseUrl(BaseUrl.BASE_URL)
            .addConverterFactory(GsonConverterFactory.create())
            .build()
    }
    fun<T> createServiceInterface(serviceInterface:Class<T>):T{
        return retrofit.create(serviceInterface)
    }
}